/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package aicue1.beans;

import aicue1.typeadapter.DateAdapter;
import java.util.ArrayList;
import java.util.Date;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;


/**
 *
 * @author Thomas
 */
@XmlRootElement(name = "Order")
public class Order {

    private String id;
    private Date orderDate;
    private Customer costumer;
    private ArrayList<Item> items;

    public Order()
    {
    }

    public Order(String id, Date orderDate, Customer customer, ArrayList<Item> items)
    {
        this.id = id;
        this.orderDate = orderDate;
        this.costumer = customer;
        this.items = items;
    }
    
    @XmlAttribute
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @XmlJavaTypeAdapter(value=DateAdapter.class)
    @XmlElement
    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    @XmlElement
    public Customer getCostumer() {
        return costumer;
    }

    public void setCostumer(Customer costumer) {
        this.costumer = costumer;
    }

    @XmlElement
     public ArrayList<Item> getItems() {
        return items;
    }

    public void setItems(ArrayList<Item> items) {
        this.items = items;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Order other = (Order) obj;
        if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 83 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    
}
